import Vue from "vue"
import VueRouter from "vue-router"

Vue.use(VueRouter)

const getRoutes = function() {
  const routes = [
    {
      path: "/someTable",
      component: () => import("../views/someTable/index.vue"),
      meta: {
        title: "表格相关"
      }
    },
    {
      path: "*",
      redirect: "/404"
    },
    {
      path: "/404",
      component: () => import("../views/404/index.vue")
    }
  ]
  routes.unshift({
    path: "/",
    redirect: routes[0].path
  })
  return routes
}

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes: getRoutes()
})

export default router
